(function(jQuery){
        
        $(window).on('ready',function($){
            addButtonBehavior();
        });
        
        var skipping = true;
        var changing = true;
        
        function addButtonBehavior(){
            $('.skip-button').on('click',function(){
               $('.skip-button').css({opacity:0.3});
               if(skipping==true){
                    skipping = false;
                    $.get(HOME_URL+'/nextsong').done(function(data){
                        setTimeout(function(){
                            skipping=true;
                            $('.skip-button').css({opacity:1});
                        },30000);
                    });
                }
            });
            
            $('.show-button').on('click',function(){
                var slug = $(this).data('slug');
                $('.show-button').css({opacity:0.3});
                if(changing==true){
                    changing = false;
                    $.post(HOME_URL+'/loadplaylist',{slug:slug}).done(function(data){
                        setTimeout(function(){
                            changing=true;
                            $('.show-button').css({opacity:1});
                        },30000);
                    });
                }
            });
        }

})();